package com.sys.domain;

import java.util.List;

public class PageBean {
	private Integer currentPage = 0;
	private Integer onePageNum = 0;
	private Integer allPage = 0;
	private List<File> filesInfo;
	private Integer time = 0;
	private Integer begin = 0;
	private Integer end = 0;
	public Integer getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}
	public Integer getAllPage() {
		return allPage;
	}
	public void setAllPage(Integer allPage) {
		this.allPage = allPage;
	}
	public List<File> getFilesInfo() {
		return filesInfo;
	}
	public void setFilesInfo(List<File> filesInfo) {
		this.filesInfo = filesInfo;
	}
	public Integer getTime() {
		return time;
	}
	public void setTime(Integer time) {
		this.time = time;
	}
	public Integer getBegin() {
		return begin>=0?begin:0;
	}
	public void setBegin(Integer begin) {
		this.begin = begin;
	}
	public Integer getEnd() {
		return end > filesInfo.size()?filesInfo.size():end;
	}
	public void setEnd(Integer end) {
		this.end = end;
	}
	public Integer getOnePageNum() {
		return onePageNum;
	}
	public void setOnePageNum(Integer onePageNum) {
		this.onePageNum = onePageNum;
	}
	public void first() {
		this.setTime(0);
		this.setBegin(time*onePageNum);
		this.setEnd((time+1)*onePageNum);
	}
	public void next() {
		if(allPage > time+1)
			time++;
		else {
			time = allPage - 1;
		}
		this.setBegin(time*onePageNum);
		this.setEnd((time+1)*onePageNum);
	}
	public void prior() {
		if(this.time - 1 < 0) {
			this.time = 0;
		}else
			this.time--;
		this.setBegin(time*onePageNum);
		this.setEnd((time+1)*onePageNum);
	}
}